<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:a4j="http://richfaces.org/a4j"
      xmlns:rich="http://richfaces.org/rich" 
      xmlns:ui="http://java.sun.com/jsf/facelets">
    <ui:composition>
        <h:head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
            <title>TODO supply a title</title>
            <script language="javascript">
                function showProj() {
                    window.open("./pubinfo/projList.jsf", "项目列表", "height=1024,width=800,toolbar=no,menubar=no,scrollbars=no");
                }
                function updateProjSelect(code, name) {
                    document.getElementById('emp:projcode').value = code;
                    document.getElementById('emp:projname').value = name;
                }

                function showDept() {
                    window.open("./pubinfo/departmentList.jsf", "部门列表", "height=1024,width=800,toolbar=no,menubar=no,scrollbars=no");
                }
                function updateDept(code, name) {
                    document.getElementById('emp:deptcode').value = code;
                    document.getElementById('emp:deptname').value = name;
                }
                function showCostItem() {
                    window.open("./page/pay/check/ecoList.jsf", "经济分类", "height=1024,width=800,toolbar=no,menubar=no,scrollbars=no");
                }
                function updateCostItemName(code, name) {
                    document.getElementById('emp:costcode').value = code;
                    document.getElementById('emp:costname').value = name;
                }
            </script>
            <style type="text/css">
                input[type='text'],select{
                    width: 120px !important;
                }
            </style>
        </h:head>
        <h:body>
            <h:form>
                <rich:panel styleClass="content-hight">
                    <rich:collapsiblePanel header="查询条件" switchType="client" expanded="false">
                        <h:panelGrid columns="4">
                            <h:outputLabel value="单据编号：" for="number" />
                            <h:inputText id="number" value="#{abroadGroupBean.qta.number}" />
                            <h:outputText value="单据日期："/>
                            <h:panelGroup>
                                <rich:calendar value="#{abroadGroupBean.qta.numDateStart}"
                                               locale="zh_CN"
                                               popup="true"
                                               datePattern="yyyy-MM-dd"
                                               showApplyButton="false"/>
                                至
                                <rich:calendar value="#{abroadGroupBean.qta.numDateEnd}"
                                               locale="zh_CN"
                                               popup="true"
                                               datePattern="yyyy-MM-dd"
                                               showApplyButton="false"/>
                            </h:panelGroup>
                            <h:outputLabel value="出差事由：" for="affair" />
                            <h:inputText id="affair" value="#{abroadGroupBean.qta.affair}" />
                            <h:outputLabel value="报销金额：" />
                            <h:panelGroup>
                                <h:inputText id="totalStart" value="#{abroadGroupBean.qta.totalStart}"/>
                                - <h:inputText id="totalEnd" value="#{abroadGroupBean.qta.totalEnd}"/>
                            </h:panelGroup>
                            <h:outputLabel value="预算项目：" for="projname" />
                            <h:inputText id="projname" value="#{abroadGroupBean.qta.project.finName}"
                                         onclick="#{rich:component('projPanel')}.show();"  />
                            <h:outputLabel value="报销人：" for="cpsn_name" />
                            <h:inputText id="cpsn_name" value="#{abroadGroupBean.qta.user.cpsn_number}" />
                            <h:outputLabel value="部门：" for="deptname" />
                            <h:inputText id="deptname" value="#{abroadGroupBean.qta.dept.name}"
                                         onclick="#{rich:component('deptPanel')}.show();"/>
                            <h:outputLabel value="支出类别：" for="costClass" />
                            <h:selectOneMenu  id="costClass" value="#{abroadGroupBean.qta.costClass}">
                                <f:selectItem itemValue=" " itemLabel="---请 选 择---"/>
                                <f:selectItem itemValue="0" itemLabel="基本支出"/>
                                <f:selectItem itemValue="1" itemLabel="项目支出"/>
                            </h:selectOneMenu>
                            <h:outputLabel value="预算来源：" for="budgetSource" />
                            <h:inputText id="budgetSource" value="#{abroadGroupBean.qta.budgetSource}" />
                            <h:outputLabel value="经济分类：" for="costname" />
                            <h:inputText id="costname" value="#{abroadGroupBean.qta.costitem.name}"
                                         onclick="showCostItem();"/>
                            <h:outputLabel value="支出渠道："  for="costType" />
                            <h:selectOneMenu  id="costType"  value="#{abroadGroupBean.qta.costTypes.code}">
                                <f:selectItem itemValue=" " itemLabel="---请 选 择---"/>
                                <f:selectItems value="#{class.selectItemList}" />
                            </h:selectOneMenu>
                            <h:outputLabel value="支付令：" for="paycode" />
                            <h:inputText id="paycode" value="#{abroadGroupBean.qta.paycode}" />
                            <h:outputLabel value="核定金额：" />
                            <h:panelGroup>
                                <h:inputText id="checkaccountStart" value="#{abroadGroupBean.qta.checkaccountStart}"/>
                                - <h:inputText id="checkaccountEnd" value="#{abroadGroupBean.qta.checkaccountEnd}"/>
                            </h:panelGroup>
                            <h:outputText value="审核日期："/>
                            <h:panelGroup>
                                <rich:calendar value="#{abroadGroupBean.qta.auditDateStart}"
                                               locale="zh_CN"
                                               popup="true"
                                               datePattern="yyyy-MM-dd"
                                               showApplyButton="false"/>
                                至
                                <rich:calendar value="#{abroadGroupBean.qta.auditDateEnd}"
                                               locale="zh_CN"
                                               popup="true"
                                               datePattern="yyyy-MM-dd"
                                               showApplyButton="false"/>
                            </h:panelGroup>
                            <h:outputLabel value="支付金额：" />
                            <h:panelGroup>
                                <h:inputText id="payaccountStart" value="#{abroadGroupBean.qta.payaccountStart}"/>
                                - <h:inputText id="payaccountEnd" value="#{abroadGroupBean.qta.payaccountEnd}"/>
                            </h:panelGroup>
                            <h:outputText value="支付日期："/>
                            <h:panelGroup>
                                <rich:calendar value="#{abroadGroupBean.qta.payDateStart}"
                                               locale="zh_CN"
                                               popup="true"
                                               datePattern="yyyy-MM-dd"
                                               showApplyButton="false"/>
                                至
                                <rich:calendar value="#{abroadGroupBean.qta.payDateEnd}"
                                               locale="zh_CN"
                                               popup="true"
                                               datePattern="yyyy-MM-dd"
                                               showApplyButton="false"/>
                            </h:panelGroup>
                            <h:inputHidden id="costcode"  value="#{abroadGroupBean.qta.costitem.code}"/>
                        </h:panelGrid>
                    </rich:collapsiblePanel>

                    <h:commandButton value="查询" action="#{abroadGroupBean.queryAbroadList}"/>
                    <h:commandButton value="取消" action="#{abroadGroupBean.cancel}"/>
                    <h:commandButton value="导出Excel" action="#{abroadGroupBean.exportExcel}" disabled="#{abroadGroupBean.abroadModel.rowCount le 0}" />

                    <div style="width:100%;overflow:auto">
                        <rich:dataTable value="#{abroadGroupBean.abroadModel}" var="tralist" rows="10"
                                        style="width:1400px;" id="tplist"
                                        noDataLabel="......">
                            <rich:column>
                                <f:facet name="header">
                                    <h:panelGroup>
                                        <h:outputText value="单据编号"/>
                                    </h:panelGroup>
                                </f:facet>
                                <h:commandLink action="#{abroadGroupBean.showPersonDetail}" immediate="true">
                                    <h:outputText value="#{tralist.number}"/>
                                </h:commandLink>
                            </rich:column>
                            <rich:column>
                                <f:facet name="header">
                                    <h:panelGroup>
                                        <h:outputText value="单据日期"/>
                                    </h:panelGroup>
                                </f:facet>
                                <h:outputText value="#{tralist.numDate}">
                                    <f:convertDateTime pattern="yyyy年MM月dd日" timeZone="GMT+8" locale="cn" />
                                </h:outputText>
                            </rich:column>
                            <rich:column>
                                <f:facet name="header">
                                    <h:panelGroup>
                                        <h:outputText value="单据状态"/>
                                    </h:panelGroup>
                                </f:facet>
                                <h:outputText value="未提交"    rendered="#{tralist.numberStatus == '1'}"/>
                                <h:outputText value="审核通过"  rendered="#{tralist.numberStatus == '2'}" style="color:blue"/>
                                <h:outputText value="退回修改"  rendered="#{tralist.numberStatus == '3'}" style="color:red"/>
                                <h:outputText value="等待审核"  rendered="#{tralist.numberStatus == '0'}" style="color:green"/>
                                <h:outputText value="确认支付"  rendered="#{tralist.numberStatus == '4'}" style="color:blue"/>
                                <h:outputText value="支付完毕"  rendered="#{tralist.numberStatus == '6'}" style="color:blue"/>
                            </rich:column>

                            <rich:column>
                                <f:facet name="header">
                                    <h:panelGroup>
                                        <h:outputText value="部门"/>
                                    </h:panelGroup>
                                </f:facet>
                                <h:outputText value="#{tralist.payDept.name}"/>
                            </rich:column>

                            <rich:column>
                                <f:facet name="header">
                                    <h:panelGroup>
                                        <h:outputText value="报销人"/>
                                    </h:panelGroup>
                                </f:facet>
                                <h:outputText value="#{tralist.feePer.cpsn_name}"/>
                            </rich:column>

                            <rich:column>
                                <f:facet name="header">
                                    <h:panelGroup>
                                        <h:outputText value="预算项目"/>
                                    </h:panelGroup>
                                </f:facet>
                                <h:outputText value="#{tralist.project.finName}"/>
                            </rich:column>
                            <rich:column>
                                <f:facet name="header">
                                    <h:panelGroup>
                                        <h:outputText value="出差事由"/>
                                    </h:panelGroup>
                                </f:facet>
                                <h:outputText value="#{tralist.affair}"/>
                            </rich:column>

                            <rich:column>
                                <f:facet name="header">
                                    <h:panelGroup>
                                        <h:outputText value="报销金额"/>
                                    </h:panelGroup>
                                </f:facet>
                                <h:outputText value="#{tralist.total}">
                                    <f:convertNumber type="number" pattern="#,##0.00"/>
                                </h:outputText>
                            </rich:column>                     

                            <rich:column>
                                <f:facet name="header">
                                    <h:panelGroup>
                                        <h:outputText value="支出类别"/>
                                    </h:panelGroup>
                                </f:facet>
                                <h:outputText value="基本支出" rendered="#{tralist.costClass == '0'}"/>
                                <h:outputText value="项目支出" rendered="#{tralist.costClass == '1'}"/>
                            </rich:column>

                            <rich:column>
                                <f:facet name="header">
                                    <h:panelGroup>
                                        <h:outputText value="预算来源"/>
                                    </h:panelGroup>
                                </f:facet>
                                <h:outputText value="#{tralist.budgetSource}"/>
                            </rich:column>

                            <rich:column>
                                <f:facet name="header">
                                    <h:panelGroup>
                                        <h:outputText value="经济分类:"/>
                                    </h:panelGroup>
                                </f:facet>
                                <h:outputText value="#{tralist.costitem.name}"/>
                            </rich:column>
                            <rich:column>
                                <f:facet name="header">
                                    <h:panelGroup>
                                        <h:outputText value="支出渠道:"/>
                                    </h:panelGroup>
                                </f:facet>
                                <h:outputText value="#{tralist.costTypes.name}"/>
                            </rich:column>

                            <rich:column>
                                <f:facet name="header">
                                    <h:panelGroup>
                                        <h:outputText value="支付令"/>
                                    </h:panelGroup>
                                </f:facet>
                                <h:outputText value="#{tralist.paycode}" style="width:350px" />
                            </rich:column>

                            <rich:column>
                                <f:facet name="header">
                                    <h:panelGroup>
                                        <h:outputText value="核定金额"/>
                                    </h:panelGroup>
                                </f:facet>
                                <h:outputText value="#{tralist.checkaccount}">
                                    <f:convertNumber type="number" pattern="#,##0.00"/>
                                </h:outputText>
                            </rich:column>

                            <rich:column>
                                <f:facet name="header">
                                    <h:panelGroup>
                                        <h:outputText value="审核日期"/>
                                    </h:panelGroup>
                                </f:facet>
                                <h:outputText value="#{tralist.auditDate}">
                                    <f:convertDateTime pattern="yyyy年MM月dd日" timeZone="GMT+8" locale="cn" />
                                </h:outputText>
                            </rich:column>

                            <rich:column>
                                <f:facet name="header">
                                    <h:panelGroup>
                                        <h:outputText value="审核人"/>
                                    </h:panelGroup>
                                </f:facet>
                                <h:outputText value="#{tralist.auditor}"/>
                            </rich:column>

                            <rich:column>
                                <f:facet name="header">
                                    <h:panelGroup>
                                        <h:outputText value="支付金额"/>
                                    </h:panelGroup>
                                </f:facet>
                                <h:outputText value="#{tralist.payaccount}">
                                    <f:convertNumber type="number" pattern="#,##0.00"/>
                                </h:outputText>
                            </rich:column>

                            <rich:column>
                                <f:facet name="header">
                                    <h:panelGroup>
                                        <h:outputText value="支付日期"/>
                                    </h:panelGroup>
                                </f:facet>
                                <h:outputText value="#{tralist.payDate}">
                                    <f:convertDateTime pattern="yyyy年MM月dd日" timeZone="GMT+8" locale="cn" />
                                </h:outputText>
                            </rich:column>

                            <rich:column>
                                <f:facet name="header">
                                    <h:panelGroup>
                                        <h:outputText value="出纳"/>
                                    </h:panelGroup>
                                </f:facet>
                                <h:outputText value="#{tralist.payer}"/>
                            </rich:column>

                            <f:facet name="footer">
                                <rich:dataScroller id="ds"></rich:dataScroller>
                            </f:facet>
                        </rich:dataTable>
                    </div>

                </rich:panel>
            </h:form>
            <rich:popupPanel id="projPanel" autosized="true">
                <f:facet name="header">项目信息</f:facet>
                <f:facet name="controls">
                    <h:outputLink value="#" onclick="#{rich:component('projPanel')}.hide();">关闭</h:outputLink>
                </f:facet>
                <h:form id="projList">
                    <rich:dataTable id="editTable" value="#{abroadGroupBean.finProjModel}" rows="10"  var="pro"
                                    onrowmouseover="this.style.backgroundColor='#F1F1F1'"
                                    onrowmouseout="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'"
                                    rowClasses="list-row-odd,list-row-even">
                        <rich:column>
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="预算项目编码"/>
                                </h:panelGroup>
                            </f:facet>
                            <a4j:commandLink id="Projlinks" action="#{abroadGroupBean.selectProjForQuery}"
                                             onclick="#{rich:component('projPanel')}.hide();"
                                             render="projname" >
                                <h:outputText value="#{pro.finCode}"/>
                            </a4j:commandLink>
                        </rich:column>

                        <rich:column>
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="预算项目名称"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="#{pro.finName}"/>
                        </rich:column>
                        <rich:column>
                            <f:facet name="header">
                                <h:panelGroup>
                                    <h:outputText value="备注"/>
                                </h:panelGroup>
                            </f:facet>
                            <h:outputText value="#{pro.memo}"/>
                        </rich:column>

                        <f:facet name="footer">
                            <rich:dataScroller id="ds"></rich:dataScroller>
                        </f:facet>
                    </rich:dataTable>
                </h:form>
            </rich:popupPanel>
            <rich:popupPanel id="deptPanel" autosized="true">
                <f:facet name="header">
                    <h:panelGroup>
                        <h:outputText value="费用承担部门"></h:outputText>
                    </h:panelGroup>
                </f:facet>
                <f:facet name="controls">
                    <h:outputLink value="#" onclick="#{rich:component('deptPanel')}.hide();">关闭</h:outputLink>
                </f:facet>
                <h:form>
                    <rich:panel>
                        <h:panelGrid columns="2" width="100%" border="0" id="mainform">
                            <rich:tree value="#{departmentBean.rootNode}" var="idept"
                                       selectionType="ajax" toggleType="client"
                                       selectionChangeListener="#{abroadGroupBean.selecteDeptForQuery}"
                                       style="width:300px" render="deptname">
                                <rich:treeNode>
                                    <h:outputText value="[#{idept.data.code}]#{idept.data.name}" />
                                    <rich:componentControl target="deptPanel" operation="hide" event="click"/>
                                </rich:treeNode>
                            </rich:tree>
                        </h:panelGrid>
                    </rich:panel>
                </h:form>

                <f:facet name="footer">
                    footer!
                </f:facet>

            </rich:popupPanel>
        </h:body>
    </ui:composition>
</html>

